<%@page import="com.tao.dao.UserDao"%>
<%@page import="com.tao.entity.User"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
</head>
<body>
<%   //获取姓名密码和年龄
    String name=request.getParameter("username");
    String pass=request.getParameter("password");
    //创建User对象，赋值
    User u=new User();
    u.setName(name);
    u.setPass(pass);
    UserDao udao=new UserDao();
    //调用udao的方法实现插入功能

    int x=udao.insert(u);
    if(x>=1){
        //转发，如果>1，跳转到success2.jsp页面
        request.getRequestDispatcher("/success2.jsp").forward(request, response);
    }else{
        request.getRequestDispatcher("/fail.jsp").forward(request, response);
    }
%>
</body>
</html>
